<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require 'dbcon.php';
$username=$_REQUEST['username'];
$content=$_REQUEST['content'];
date_default_timezone_set('Asia/Shanghai');
$wdate=date("Y-m-d h:i:s");
$sql="INSERT INTO tb_wish(username,content,wdate) VALUES( '{$username}', '{$content}', '{$wdate}')";
$rs=$db->query($sql);//执行查询语句$sql，生成结果集$result
$id=mysqli_insert_id($db);
$db->close();//关闭数据库连接
if ($rs==true)
{
    //msg=1  username  content wdate
    $data=array('msg'=>1,'username'=>$username,"content"=>$content,"wdate"=>$wdate,"id"=>$id);
    echo json_encode($data);
    
}
else   
{
  echo 0;
}
